<?php

require_once(sfConfig::get('sf_lib_dir').'/filter/base/BaseFormFilterPropel.class.php');

/**
 * Chatroom filter form base class.
 *
 * @package    alika
 * @subpackage filter
 * @author     Your name here
 * @version    SVN: $Id: sfPropelFormFilterGeneratedTemplate.php 16976 2009-04-04 12:47:44Z fabien $
 */
class BaseChatroomFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'from_id'    => new sfWidgetFormPropelChoice(array('model' => 'sfGuardUser', 'add_empty' => true)),
      'to_id'      => new sfWidgetFormPropelChoice(array('model' => 'sfGuardUser', 'add_empty' => true)),
      'pub'        => new sfWidgetFormFilterInput(),
      'accept'     => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'minute'     => new sfWidgetFormFilterInput(),
      'created_at' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'is_active'  => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
      'time'       => new sfWidgetFormFilterInput(),
      'time_start' => new sfWidgetFormFilterInput(),
      'time_end'   => new sfWidgetFormFilterInput(),
      'date_start' => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'date_end'   => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => true)),
      'with_video' => new sfWidgetFormChoice(array('choices' => array('' => 'yes or no', 1 => 'yes', 0 => 'no'))),
    ));

    $this->setValidators(array(
      'from_id'    => new sfValidatorPropelChoice(array('required' => false, 'model' => 'sfGuardUser', 'column' => 'id')),
      'to_id'      => new sfValidatorPropelChoice(array('required' => false, 'model' => 'sfGuardUser', 'column' => 'id')),
      'pub'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'accept'     => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'minute'     => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'created_at' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'is_active'  => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
      'time'       => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'time_start' => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'time_end'   => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'date_start' => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'date_end'   => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'with_video' => new sfValidatorChoice(array('required' => false, 'choices' => array('', 1, 0))),
    ));

    $this->widgetSchema->setNameFormat('chatroom_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'Chatroom';
  }

  public function getFields()
  {
    return array(
      'id'         => 'Number',
      'from_id'    => 'ForeignKey',
      'to_id'      => 'ForeignKey',
      'pub'        => 'Number',
      'accept'     => 'Boolean',
      'minute'     => 'Number',
      'created_at' => 'Date',
      'is_active'  => 'Boolean',
      'time'       => 'Number',
      'time_start' => 'Number',
      'time_end'   => 'Number',
      'date_start' => 'Date',
      'date_end'   => 'Date',
      'with_video' => 'Boolean',
    );
  }
}
